<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                template="/templates/ui.xhtml">

    <ui:define name="head">
        <link type="text/css" href="#{request.contextPath}/UI/epss/epss.css" rel="stylesheet"/>
        <script type="text/javascript" src="#{request.contextPath}/UI/support/pub.js"/>
        <script type="text/javascript" language="javascript">
            document.onkeydown = function TabReplace() {
                if (event.keyCode == 13) {
                    if (event.srcElement.tagName != 'BUTTON')
                        event.keyCode = 9;
                    else
                        event.srcElement.click();
                }
            }
            function actSelect(obj) {
                var pkid=obj;
                var sfeature = "dialogwidth:1100px;dialogheight:600px;center:yes;location:no;help:no;resizable:no;scroll:no;status:no";
                var arg = new Object();
                arg.doType = "select";

                var rtn =dialog("../item/itemQry_SubcttEngMStl.xhtml?strEsInitStlSubcttEng="+pkid+"",arg,sfeature);
            }
        </script>
    </ui:define>
    <ui:define name="content">
        <h:form id="form" enctype="multipart/form-data">
            <p:growl id="msgs" showDetail="true"/>
            <p:focus for="id"/>
                <h:panelGrid id="pgCondition" style="width: 100%">
                    <h:panelGrid columns="6">
                        <h:outputLabel value="结算编号：" for="id" />
                        <p:inputText id="id" value="#{esInitSubcttStlMAction.itemEsInitStl.id}"
                                     disabled="#{esInitSubcttStlMAction.styleModel.disabled_Flag}"
                                     style="#{esInitSubcttStlMAction.styleModel.disabled_Style};"/>
                        <h:outputLabel value="分包合同：" for="stlPkid" />
                        <p:selectOneMenu id="stlPkid"
                                         value="#{esInitSubcttStlMAction.itemEsInitStl.stlPkid}"
                                         disabled="#{esInitSubcttStlMAction.styleModel.disabled_Flag}"
                                         style="#{esInitSubcttStlMAction.styleModel.disabled_Style};">
                            <f:selectItems value="#{esInitSubcttStlMAction.subcttList}"/>
                        </p:selectOneMenu>
			            <h:outputLabel value="备注内容：" for="note"/>
                        <p:inputText id="note" value="#{esInitSubcttStlMAction.itemEsInitStl.note}"/>
                    </h:panelGrid>
                    <h:panelGrid columns="4">
                        <h:outputLabel value="期数编码：" for="periodNo"/>
                        <p:inputText id="periodNo" value="#{esInitSubcttStlMAction.itemEsInitStl.periodNo}"
                                     onclick="WdatePicker({dateFmt:'yyyyMM'})"
                                     disabled="#{esInitSubcttStlMAction.styleModel.disabled_Flag}"
                                     style="#{esInitSubcttStlMAction.styleModel.disabled_Style};"/>
                        <h:outputLabel value="状态标志：" for="statusFlag"/>
                        <p:selectOneMenu id="statusFlag" value="#{esInitSubcttStlMAction.itemEsInitStl.statusFlag}">
                            <f:selectItems value="#{esFlowControl.statusFlagList}"/>
                        </p:selectOneMenu>
                    </h:panelGrid>
                    <h:panelGrid columns="5">
                        <p:commandButton id="qryBtn" value="查询"
                                         action="#{esInitSubcttStlMAction.onQueryAction('Check')}"
                                         update="pdt,msgs">
                        </p:commandButton>
                        <p:commandButton id="resetBtn" value="重置"
                                         action="#{esInitSubcttStlMAction.resetAction}"
                                         update="pgCondition,msgs">
                        </p:commandButton>
                        <p:ajaxStatus style="width:16px;height:16px;">
                            <f:facet name="start">
                                <h:graphicImage value="/images/ajaxloading.gif"/>
                            </f:facet>
                            <f:facet name="complete">
                                <h:outputText value=""/>
                            </f:facet>
                        </p:ajaxStatus>
                        <p:commandButton id="checkPassBtn" value="审核通过"
                                         action="#{esInitSubcttStlMAction.onClickForPowerAction('CheckPass')}"
                                         update="pgCondition,pdt,msgs"
                                         rendered="#{esInitSubcttStlMAction.rowSelectedFlag}">
                        </p:commandButton>
                        <p:commandButton id="checkFailBtn" value="审核未过"
                                         action="#{esInitSubcttStlMAction.onClickForPowerAction('CheckFail')}"
                                         update="pgCondition,pdt,msgs"
                                         rendered="#{esInitSubcttStlMAction.rowSelectedFlag}">
                        </p:commandButton>
                    </h:panelGrid>
                </h:panelGrid>


            <!--列表维护-->
            <p:contextMenu for="pdt">
                <p:menuitem value="选择" icon="ui-icon-plus"
                            actionListener="#{esInitSubcttStlMAction.selectRecordAction('Check','')}"
                            update="pdt,msgs,pgCondition">
                </p:menuitem>
                <p:menuitem value="详细内容" icon="ui-icon-search"
                            oncomplete="actSelect(DtInitSubcttList.selection)">
                </p:menuitem>
            </p:contextMenu>
            <p:dataTable id="pdt" style="width:100%;"
                         value="#{esInitSubcttStlMAction.itemEsInitStlList}"
                         var="record"
                         rowKey="#{record.pkid}"
                         selection="#{esInitSubcttStlMAction.itemEsInitStlSelected}"
                         selectionMode="single"
                         paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks}
                         {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                         paginator="true"
                         paginatorPosition="bottom"
                         rows="15"
                         rowIndexVar="row"
                         rowsPerPageTemplate="500,200,90,45,30,15"
                         emptyMessage="数据记录为空..."
                         widgetVar="DtInitSubcttList"
                         rowStyleClass="#{record.statusFlag eq '0'? null : 'rowDoneStyle'}"
                         scrollable="true"
                         scrollHeight="440">
                <p:column headerText="序号" style="width:30px">
                    <h:outputText value="#{row + 1}"/>
                </p:column>
                <p:column headerText="结算编号" style="text-align:center;width:120px">
                    <h:outputText value="#{record.id}"/>
                </p:column>
                <p:column headerText="分包合同" style="text-align:left;width:200px">
                    <h:outputText value="#{record.stlName}"/>
                </p:column>
                <p:column headerText="协作单位" style="text-align:left;width:200px">
                    <h:outputText value="#{record.signPartBName}"/>
                </p:column>
                <p:column headerText="期数编码" style="text-align:center;width:66px">
                    <h:outputText value="#{record.periodNo}"/>
                </p:column>
                <p:column headerText="今期状态" style="text-align:center;width:66px;">
                    <h:outputText value="#{esFlowControl.getLabelByValueInStatusFlaglist(record.statusFlag)}"/>
                </p:column>
                <p:column headerText="今期原因" style="text-align:center;width:66px;">
                    <h:outputText value="#{esFlowControl.getLabelByValueInPreStatusFlaglist(record.preStatusFlag)}"/>
                </p:column>
                <p:column headerText="结束标志" style="text-align:center;width:66px;">
                    <h:outputText value="#{esFlowControl.getLabelByValueInEndFlagList(record.endFlag)}"/>
                </p:column>
            </p:dataTable>
        </h:form>
    </ui:define>
</ui:composition>